<% if (quote) { %>
<blockquote>
    <p><%- quote; %></p>
</blockquote>
<% } %>
<% if (pagination) { %>
<script src="https://cdn.jsdelivr.net/npm/ejs@3.1.8/ejs.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios@0.27.2/dist/axios.min.js"></script>
<% } %>
<style>
    <%- include('index.css') %>
    <% if (theme) { %>
    <%- include(`theme/${theme}.min.css`) %>
    <% } %>
</style>
<div class="bangumi-tabs">
    <a class="bangumi-tab" id="bangumi-tab1" href="javascript:;" rel="external" target="_self" onclick="return false">
    <%= __(type === 'game' ? 'wantPlay' : 'wantWatch') %>
    (<%= wantWatch.length %>)</a>
    <a class="bangumi-tab" id="bangumi-tab2" href="javascript:;" rel="external" target="_self" onclick="return false">
        <%= __(type === 'game' ? 'playing' : 'watching') %>
        (<%= watching.length %>)</a>
    <a class="bangumi-tab" id="bangumi-tab3" href="javascript:;" rel="external" target="_self" onclick="return false">
        <%= __(type === 'game' ? 'played' : 'watched') %>
        (<%= watched.length %>)</a>
</div>
<div>
    <div id="bangumi-item1">
        <% if (pagination) { %>
        <% wantWatch.slice(0, 10).forEach(function(item){ %>
        <%- include((source === 'bili' ? 'bili' : (source === 'bgmv0' ? 'bgmv0' : 'bgm')) + '-template.ejs', {item,loading,metaColor,type,lazyloadAttrName,srcValue}) %>
        <% }); %>
        <%- include('pagination.ejs', {__: __}) %>
        <% } else { %>
        <% wantWatch.forEach(function(item){ %>
        <%- include((source === 'bili' ? 'bili' : (source === 'bgmv0' ? 'bgmv0' : 'bgm')) + '-template.ejs', {item,loading,metaColor,type,lazyloadAttrName,srcValue}) %>
        <% }); %>
        <%- include('pagination.ejs', {__: __}) %>
        <% } %>
    </div>
    <div id="bangumi-item2">
        <% if (pagination) { %>
        <% watching.slice(0, 10).forEach(function(item){ %>
        <%- include((source === 'bili' ? 'bili' : (source === 'bgmv0' ? 'bgmv0' : 'bgm')) + '-template.ejs', {item,loading,metaColor,type,lazyloadAttrName,srcValue}) %>
        <% }); %>
        <%- include('pagination.ejs', {__: __}) %>
        <% } else { %>
        <% watching.forEach(function(item){ %>
        <%- include((source === 'bili' ? 'bili' : (source === 'bgmv0' ? 'bgmv0' : 'bgm')) + '-template.ejs', {item,loading,metaColor,type,lazyloadAttrName,srcValue}) %>
        <% }); %>
        <%- include('pagination.ejs', {__: __}) %>
        <% } %>
    </div>
    <div id="bangumi-item3">
        <% if (pagination) { %>
        <% watched.slice(0, 10).forEach(function(item){ %>
        <%- include((source === 'bili' ? 'bili' : (source === 'bgmv0' ? 'bgmv0' : 'bgm')) + '-template.ejs', {item,loading,metaColor,type,lazyloadAttrName,srcValue}) %>
        <% }); %>
        <%- include('pagination.ejs', {__: __}) %>
        <% } else { %>
        <% watched.forEach(function(item){ %>
        <%- include((source === 'bili' ? 'bili' : (source === 'bgmv0' ? 'bgmv0' : 'bgm')) + '-template.ejs', {item,loading,metaColor,type,lazyloadAttrName,srcValue}) %>
        <% }); %>
        <%- include('pagination.ejs', {__: __}) %>
        <% } %>
    </div>
</div>
<script>
    (function () {
    <% if (pagination) { %>
    const ejsTemplate = '<%- ejsTemplate.replace(/\n/g, '') %>';
    const loading = '<%- loading %>';
    const metaColor = '<%- metaColor %>';
    const type = '<%- type %>';
    const color = '<%- color %>';
    const showMyComment = <%- showMyComment %>;
    const pagenumsPre = <%- JSON.stringify([wantWatch.length, watching.length, watched.length]) %>;
    <% } %>
    const bangumiLazyload = <%- (!!lazyload).toString() %>;
    <%- include('index.js') %>
    document.getElementsByClassName('bangumi-tab')[<%- show %>].click();
    <%- include('pagination.js', {__: __}) %>
    })();
</script>
